<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户管理</title>
<link rel="stylesheet" href="../resources/css/bootstrap.min.css" />
<link rel="stylesheet" href="../resources/css/font-awesome.min.css" />
<link rel="stylesheet" href="../resources/css/ace.min.css" />
<link rel="stylesheet"
	href="../resources/js/layer/skin/default/layer.css" />
</head>
<body>
	<div class="page-content">
		<div class="page-header">
			<h1>新增</h1>
		</div>
		<!-- /.page-header -->
		<div class="row">
			<div class="col-xs-12">
				<form id="save-form" class="form-horizontal" role="form"
					action="../emp/save" method="post">
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right"
							for="form-field-1">姓名</label>
						<div class="col-sm-9">
							<input type="text" id="empName" name="empName" value=""
								class="col-xs-10 col-sm-8" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right"
							for="form-field-1">性别</label>
						<div class="col-sm-9">
							<label> 男<input name="gender" class="ace" type="radio"
								value="男" checked /> <span class="lbl"></span>
							</label> <label> 女<input name="gender" class="ace" type="radio"
								value="女" /> <span class="lbl"></span>
							</label>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right"
							for="form-field-1">电话</label>
						<div class="col-sm-9">
							<input type="text" id="phone" name="phone"
								class="col-xs-10 col-sm-8" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right"
							for="form-field-1">QQ号码</label>
						<div class="col-sm-9">
							<input type="text" id="empQQ" name="empQQ" value=""
								class="col-xs-10 col-sm-8" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right"
							for="form-field-1">应聘岗位</label>
						<div class="col-sm-9">
							<input type="text" id="empPosition" name="empPosition"
								value="${user.phone }" class="col-xs-10 col-sm-8" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right"
							for="form-field-1">学历</label>
						<div class="col-sm-9">
							<select class="col-xs-10 col-sm-8" name="education"
								id="education">
								<option value="本科">本科</option>
								<option value="大专">大专</option>
								<option value="硕士">硕士</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right"
							for="form-field-1">专业</label>
						<div class="col-sm-9">
							<input type="text" id="major" name="major" value=""
								class="col-xs-10 col-sm-8" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right"
							for="form-field-1">学校</label>
						<div class="col-sm-9">
							<input type="text" id="school" name="school" value=""
								class="col-xs-10 col-sm-8" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right"
							for="form-field-1">年龄</label>
						<div class="col-sm-9">
							<input type="text" id="birthday" name="birthday" value=""
								class="col-xs-10 col-sm-8" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right"
							for="form-field-1">毕业时间</label>
						<div class="col-sm-9">
							<input type="text" id="graduateDate" name="graduateDate" value=""
								class="col-xs-10 col-sm-8" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right"
							for="form-field-1">来源</label>
						<div class="col-sm-9">
							<input type="text" id="source" name="source" value=""
								class="col-xs-10 col-sm-8" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label no-padding-right"
							for="form-field-1">状态</label>
						<div class="col-sm-9">
							<select class="col-xs-10 col-sm-8" name="empStatus"
								id="empStatus">
								<option value="A">A</option>
								<option value="B">B</option>
								<option value="C" selected="selected">C</option>
								<option value="B">D</option>
							</select>
						</div>
					</div>
					<div class="col-md-offset-3 col-md-9" align="center">
						<button class="btn btn-info" type="button" id="save-btn">
							<i class="icon-ok bigger-110"></i> 保存
						</button>
					</div>
				</form>
			</div>
		</div>
	</div>
	<%@ include file="../common.jsp"%>
	<script src="../resources/js/jquery-1.11.3.js"></script>
	<script type="text/javascript">
		$(function() {
			$("#save-btn").on(
					"click",
					function() {

						var paramters = $("#save-form").serialize();
						if ($("#empName").val() == "") {
							layer.msg("用户名不能为空", {
								offset : 't',
								anim : 6
							});
							return;
						}
						if ($("#phone").val() == "") {
							layer.msg("电话不能为空", {
								offset : 't',
								anim : 6
							});
							return;
						}
						// 发送请求
						$.ajax({
							"type" : "POST",
							"url" : "../emp/addEmp",
							"data" : paramters,
							"dataType" : "json",
							"success" : function(resp) {
								if (resp.code == 200) {
									layer.confirm('添加成功!是否关闭窗口?', function(
											index) {
										layer.close(index);
										var index = parent.layer
												.getFrameIndex(window.name); //获取窗口索引
										parent.layer.close(index);
										parent.$('#table').bootstrapTable('refresh');
										return false;
									});
								} else {
									layer.alert(resp.msg, {
										"icon" : 2
									});
								}
								/* if (data.msg == 'success') {
									layer.confirm('添加成功!是否关闭窗口?', function(index) {
										layer.close(index);
										$("#myModal").modal('hide'); // 手动关闭
										$('#table').bootstrapTable('refresh');
										return false;
									});
									// $('#table').bootstrapTable('refresh');
								} else {
									layer.msg('添加失败！');
								} */
							},
							error : function() {
								layer.msg('添加失败！');
							}
						});
						//$("#save-form").submit();
					});
		});
	</script>
</body>
</html>